<?php


class vi_PropertyCollector extends vi_Service
{
    public function CheckForUpdates($version)
    {
        $parms = array('version' => $version);
        $msg = new vi_Message('CheckForUpdates', $parms);

        $result = $this->svc->call($msg, $this->ServiceReference());

        return ($result !== false);
    }


    public function RetrieveProperties($filter)
    {
        $parms = array('specSet' => $filter);
        $msg = new vi_Message('RetrieveProperties', $parms);

        $result = $this->svc->call($msg, $this->ServiceReference());
        if ($result === false)
            throw new Exception($this->svc->errorMessage);

        return $result;
    }


    static public function ConvertProperties($data)
    {
        $properties = array();
        if (is_assoc($data))
        {
            $properties[$data['name']] = $data['val'];
        }
        else
        {
            foreach ($data as $k => $v)
            {
                $properties[$v['name']] = $v['val'];
            }
        }

        return $properties;
    }
}


?>
